{% macro userInfo(user,isMe,isMeFollow,atCount) %}
<div class="user-info">
  <div class="user-title" style="margin-top: 50px;">
    <img src="{{user.avatar}}" width=60px" height="60" style="border-radius:50%;">
    <span style="font-size: 30px;">&nbsp;{{user.nickName}}</span>
  </div>
  {% if isMe %}
  <a href="/atMe"
    style="font-size: 20px;display: flex;margin-top:25px;justify-content: space-between;">@提到我的({{atCount}})</a>
  {% else %}
  {% if isMeFollow %}
  <button class="nofollow">取消关注</button>
  {% else %}
  <button class="follow">关注</button>
  {% endif %}
  {% endif %}
</div>
<hr>
<script>
  $('.follow').click(function () {
    // 获取被关注人的id  followId
    const followerId = '{{user.id}}';
    ajax.post("/api/profile/follow",
      { followerId },
      function (err, data) {
        if (err) {
          alert(err);
          return
        }
        alert("关注成功")
        // 刷新页面
        location.href = "";
      })
  });
  $('.nofollow').click(function () {
    const followerId = '{{user.id}}';
    ajax.post("/api/profile/nofollow", { followerId },
      function (err, data) {
        if (err) {
          alert(err);
          return
        }
        alert("取消关注成功")
        // 刷新页面
        location.href = "";
      })
  })
</script>
{% endmacro %}